package com.zxl.openapi.swagger;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfig {

    @Bean
    public Docket docket(ApiInfo apiInfo){
                          //选择版本
        return new Docket(DocumentationType.SWAGGER_2)
                  //设置接口文档的相关基础信息
                .apiInfo(apiInfo)
                //对那些接口生效
                .select()
                //所有接口
                .apis(RequestHandlerSelectors.any())
                //路径
                .paths(PathSelectors.any())
                .build();
    }

    @Bean
    public ApiInfo apiInfo(){

        return new ApiInfoBuilder()
                .title("缓存模块接口文档")
                .version("99.99")
                .description("这不是描述,这不是描述,这是接口地址")
                .contact(new Contact("强哥","http://www.qiandu.com","qiangge@qiangge.qiangge"))
                .license("apache 2.0")
                .licenseUrl("https://www.apache.org/licenses/LICENSE-2.0.html")
                .build();

    }


}
